export const toast = ({ title = '数据加载中', icon = 'none', mask = true, duration = 3000 } = {}) => {
  wx.showToast({
    title,
    icon,
    mask,
    duration
  })
}

export const modal = (option = {}) => {
  return new Promise((resolve) => {
    // 默认的参数
    const defaultOpt = {
      title: "提示",
      content: "您确定执行该操作吗",
      confirmColor: "#f3514f"
    }
    const opts = Object.assign({}, defaultOpt, option)
    wx.showModal({
      ...opts,
      complete({ confirm, cancel }) {
        confirm && resolve(true)
        cancel && resolve(false)
      }
    })
  })
}